package com.shujia.homework;

/*
构造方法与重载：定义一个网络用户类，要处理的信息有用户 ID、用户密码、 email 地址。
在建立类的实例时把以上三个信息都作为构造函数的参数输入，
其中用户 ID 和用户密码时没有缺省，而email地址缺省的时候 email地址是用户 ID 加上字符串"@gameschool.com"。
 */
public class NetUser {
    private String ID;
    private String password;
    private String email;

    public NetUser() {
    }

    public NetUser(String ID, String password) {
        this.ID = ID;
        this.password = password;
        this.email = ID + "@gameschool.com";
    }

    public NetUser(String ID, String password, String email) {
        this.ID = ID;
        this.password = password;
        this.email = email;
    }

    public static void main(String[] args) {
        NetUser user = new NetUser("1001", "123456", "abc@qq.com");
        System.out.println(user.toString());


        NetUser user1 = new NetUser("1001", "123456");
        System.out.println(user1.toString());

    }

    @Override
    public String toString() {
        return "NetUser{" +
                "ID='" + ID + '\'' +
                ", password='" + password + '\'' +
                ", email='" + email + '\'' +
                '}';
    }
}











